Skip to content

feat(stv): follow the service's startup status instead of a blind join timeout - #33

Merged
sqrt-negativeone merged 3 commits into
mainfrom
feat/startup-status-inactivity-timeout
Oct 15, 2026
Merged

sqrt-negativeone merged 3 commits into
mainfrom
feat/startup-status-inactivity-timeout

Conversation

@sqrt-negativeone

Copy link
Copy Markdown
Contributor

What & why

A direct-WebRTC start was bounded by a blind client-side total (webrtc_join_timeout_s), and no client-side number is right for every cold start. The inference service now reports its startup progress: a sessionPing every few seconds before sessionReady, carrying the phase (waiting_for_container, setting_up_session) and elapsed time, and it bounds each phase itself (companion change in journee-live/ojin, inference-proxy 0.7.11).

This release makes the client follow that:

  • OjinSessionReadyPing carries phase and elapsed_ms (both None on an older service, which sends the bare ping).
  • New STVEvent.SESSION_STARTING (phase, elapsed_ms), emitted per report, so a bot can show which phase a slow start is in.
  • From the first report, the fixed join timer is replaced by a watchdog: the start fails (WEBRTC_JOIN_TIMEOUT, message naming the last phase) only after startup_inactivity_timeout_s (default 20 s) of silence. The total is the service's responsibility.
  • A service that sends no reports is handled exactly as before: webrtc_join_timeout_s (default 90 s) applies.

Release

Bumps ojin-client to 0.12.2; entries are under 0.12.2 in CHANGELOG.md. Merging publishes it to PyPI.

Verification

  • uv run ruff format --check, uv run ruff check: clean.
  • uv run pytest tests --ignore=tests/integration: 295 passed, including: reports past the join timeout keep the start alive and the session then connects; reports going silent fail the start with the last phase in the message; a bare ping from an older service still counts as progress; the transport parses both ping shapes.
  • uvx pyright: the same 2 pre-existing errors in entities/interaction_messages.py, untouched here.
  • Not exercised against a live service; the proxy side is in the companion PR.

…n timeout

The inference service now sends a sessionPing every few seconds while a
session is starting, naming the phase and elapsed time, and bounds each
phase itself. From the first such report the client drops its fixed
webrtc_join_timeout_s timer and fails only after
startup_inactivity_timeout_s (default 20 s) of silence, so a long cold
start is no longer cut off by a number the client had to guess. Each
report is surfaced as STVEvent.SESSION_STARTING. A service that sends no
reports is handled as before. Bumps ojin-client to 0.12.2.
A sessionPing whose fields had unexpected types raised in the transport
and took the connection down with a misleading CONNECTION_CLOSED; the
fields are now coerced loosely and left unset when odd. A first report
arriving while close() was mid-teardown re-armed the silence watchdog,
which later emitted an ERROR after CLOSED; close() now awaits the
startup timer and both the report handler and the watchdog stop once
closed. A server errorResponse also cancels the startup timer so no
second ERROR can follow it. Docs name the event as direct-WebRTC only
and both client-local settings; tests cover each case.
json.loads admits both literals and int() refuses them, which would have
ended the session the same way a wrongly typed field did. Adds the
regression test for a server errorResponse leaving no startup timer
behind: with a slow ERROR listener the old code emitted a second
WEBRTC_JOIN_TIMEOUT before closing.
@sqrt-negativeone
sqrt-negativeone merged commit 1e5a566 into main Oct 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant